/*
 * Copyright 2014 Henrik Baerbak Christensen, Aarhus University
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */ 
package cs.rsa.ts14.juliet;

import cs.rsa.ts14.framework.ClassType;

/** Define a mapping between categories to their
 * respective classes. Ideally a configurable mapping
 * but fixed in this exercise.
 * 
 * @author Henrik Baerbak Christensen, Aarhus University
 *
 */
public class ClassMap {

	/** Class definitions*/
	public static final String CLASS_TEACHING = "teaching";
	public static final String CLASS_RESEARCH = "research";
	public static final String CLASS_MISC = "misc";
	public static final String CLASS_CONSULENT = "consulent";
	public static final String CLASS_ADM = "adm";
	
	/** Category definitions */
	public static final String CAT_SAIP = "saip";
	public static final String CAT_CENSOR = "censor";
	public static final String CAT_SA = "sa";
	public static final String CAT_MTT = "mtt";
	public static final String CAT_ES = "es";
	public static final String CAT_BOOK2 = "book2";
	public static final String CAT_N4C = "n4c";
	public static final String CAT_SYG = "syg";
	public static final String CAT_TERNA = "terna";
	public static final String CAT_ITEVMD = "itevmd";
	public static final String CAT_ADM = "adm";
	
	
  public static ClassType mapCategoryToClass(String category) {
    switch( category ) {
    case CAT_SAIP:
    case CAT_CENSOR:
    case CAT_SA:
    case CAT_MTT:
      return ClassType.TEACHING;

    case CAT_ES:
    case CAT_BOOK2:
    case CAT_N4C:
      return ClassType.RESEARCH;

    case CAT_SYG:
      return ClassType.MISC;
    
    case CAT_TERNA:
      return ClassType.CONSULENT;
      
    case CAT_ITEVMD:
    case CAT_ADM:
      return ClassType.ADM;
      
    default:
        return null;
    }
  }
  
  public static String getClassTypeAsString(ClassType type) {
	  switch(type){ 
	  	case TEACHING:
	  		return CLASS_TEACHING;
	  	case RESEARCH:
	  		return CLASS_RESEARCH;
	  	case MISC:
	  		return CLASS_MISC;
	  	case CONSULENT:
	  		return CLASS_CONSULENT;
	  	case ADM:
	  		return CLASS_ADM;
	  	default:
	  		return null;
	  }
  }
  

}

/*
-- Time spent on classes and categories --
teaching                  47.0 ( 68%)
    saip     :     2.0
    censor   :     0.5
    sa       :    41.5
    mtt      :     3.0
research                   9.5 ( 14%)
    es       :     4.5
    book2    :     1.0
    n4c      :     4.0
misc                       4.5 (  6%)
    syg      :     4.5
consulent                  1.5 (  2%)
    terna    :     1.5
adm                        8.5 ( 12%)
    itevmd   :     2.5
    adm      :     6.0
*/